<template>
  <div id="moreRoles">
    <div class="moreRoles-title">
      <div class="backDetails" @click="backDetails()">返回</div>
    </div>

    <div class="role-list">
      <div
        class="role-item"
        :class="{ selected: item.selected }"
        v-for="item in roleList"
        :key="item.id"
        @click="selectRole(item.id)"
      >
        <div class="isSelected">
          <img
            src="@/assets/img/sceneMaking/ischecked.png"
            alt=""
            v-show="item.selected"
          />
          <img
            src="@/assets/img/sceneMaking/nochecked.png"
            alt=""
            v-show="!item.selected"
          />
          <span :style="{ color: item.selected ? '#457aff' : '#707175' }">{{
            item.selected ? "选中" : "未选中"
          }}</span>
        </div>
        <div class="avatar">
          <div class="avatar-placeholder"></div>
        </div>
        <div class="role-info">
          <div class="name">{{ item.name }}</div>
          <div class="info-row">
            <span class="label">岗位：</span>
            <span class="value">{{ item.position }}</span>
          </div>
          <div class="info-row">
            <span class="label">年龄：</span>
            <span class="value">{{ item.age }}</span>
          </div>
          <div class="info-row">
            <span class="label">性格：</span>
            <span class="value">{{ item.personality }}</span>
          </div>
          <div class="info-row">
            <span class="label">数字人形象：</span>
            <span class="value">{{ item.shuzirenPic }}</span>
          </div>
          <div class="info-row">
            <span class="label">数字人声音：</span>
            <span class="value">{{ item.shuzirenVoice }}</span>
          </div>
          <div class="info-row">
            <span class="label">经历：</span>
            <span class="value" :title="item.experience">{{
              item.experience
            }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 角色列表数据
      roleList: [
        {
          id: 1,
          name: "陈强",
          position: "私人银行高级理财经理",
          age: "35岁",
          personality: "专业严谨、富于钻研、具有密切的市场洞察力",
          shuzirenPic: "商业比较、沟通与信",
          shuzirenVoice: "低沉稳重，富有磁性",
          experience:
            "10年金融行业从业经验，服务过500+高净值客户10年金融行业从业经验，服务过500+高净值客户10年金融行业从业经验，服务过500+高净值客户10年金融行业从业经验，服务过500+高净值客户",
          selected: false,
        },
        {
          id: 2,
          name: "陈强",
          position: "私人银行高级理财经理",
          age: "35岁",
          personality: "专业严谨、富于钻研、具有密切的市场洞察力",
          shuzirenPic: "商业比较、沟通与信",
          shuzirenVoice: "低沉稳重，富有磁性",
          experience: "10年金融行业从业经验，服务过500+高净值客户",
          selected: false,
        },
        {
          id: 3,
          name: "陈强",
          position: "私人银行高级理财经理",
          age: "35岁",
          personality: "专业严谨、富于钻研、具有密切的市场洞察力",
          shuzirenPic: "商业比较、沟通与信",
          shuzirenVoice: "低沉稳重，富有磁性",
          experience: "10年金融行业从业经验，服务过500+高净值客户",
          selected: false,
        },
        {
          id: 4,
          name: "陈强",
          position: "私人银行高级理财经理",
          age: "35岁",
          personality: "专业严谨、富于钻研、具有密切的市场洞察力",
          shuzirenPic: "商业比较、沟通与信",
          shuzirenVoice: "低沉稳重，富有磁性",
          experience: "10年金融行业从业经验，服务过500+高净值客户",
          selected: false,
        },
        {
          id: 5,
          name: "陈强",
          position: "私人银行高级理财经理",
          age: "35岁",
          personality: "专业严谨、富于钻研、具有密切的市场洞察力",
          shuzirenPic: "商业比较、沟通与信",
          shuzirenVoice: "低沉稳重，富有磁性",
          experience: "10年金融行业从业经验，服务过500+高净值客户",
          selected: false,
        },
      ],
    };
  },
  mounted() {
    window.scrollTo(0, 0);
  },
  methods: {
    // 选择角色（支持多选）
    selectRole(id) {
      const role = this.roleList.find((role) => role.id === id);
      if (role) {
        role.selected = !role.selected;
      }
    },

    // 返回
    backDetails() {
      this.$router.push("/sceneMake/sceneMakeDetails");
    },
  },
};
</script>

<style lang="scss" scoped>
#moreRoles {
  width: 1200px;
  margin: 0 auto;
  .moreRoles-title {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
    .backDetails {
      width: 100px;
      height: 38px;
      background: #4f46e5;
      border-radius: 4px;
      font-size: 16px;
      color: #ffffff;
      text-align: center;
      line-height: 38px;
      cursor: pointer;
      &:hover {
        background: #4338ca;
      }
    }
  }
  // 角色列表
  .role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;

    .role-item {
      position: relative;
      width: calc(33% - 10px);
      background: #ffffff;
      box-shadow: 0px 0px 28px 1px rgba(0, 0, 0, 0.08);
      border-radius: 20px;
      padding: 35px 25px 20px 25px;
      display: flex;
      flex-direction: column;
      align-items: center;
      box-sizing: border-box;

      &:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        transform: translateY(-2px);
      }

      &.selected {
        border: 2px solid #457aff;
      }

      .isSelected {
        position: absolute;
        top: 22px;
        right: 22px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 9px;
      }

      .avatar {
        margin-bottom: 20px;

        .avatar-placeholder {
          width: 140px;
          height: 140px;
          border-radius: 50%;
          background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
          border: 3px solid #f0f9ff;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }
      }

      .role-info {
        width: 100%;
        margin-bottom: 20px;

        .name {
          font-weight: bold;
          font-size: 21px;
          color: #374151;
          margin-bottom: 15px;
          text-align: left;
        }

        .info-row {
          display: flex;
          align-items: flex-start;
          margin-bottom: 10px;
          font-size: 14px;
          line-height: 1.6;

          &:last-child {
            margin-bottom: 0;
          }

          .label {
            font-size: 14px;
            color: #374151;
            font-weight: bold;
            flex-shrink: 0;
          }

          .value {
            font-size: 14px;
            color: #374151;
            word-break: break-all;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
            max-width: 100%;
          }
        }
      }

      .actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 20px;
        padding-top: 15px;

        .action-btn {
          font-size: 14px;
          cursor: pointer;
          transition: all 0.2s ease;

          &.edit {
            color: #4f46e5;
          }

          &.delete {
            color: #4f46e5;
          }
        }
      }
    }
  }
}
</style>